Imports System.Drawing

''' <summary>
''' The jChart.Indicator object describes an 
''' indicator. Indicators are markers that appear at data points 
''' on scatter charts and optionally on line charts.
''' </summary>
''' <remarks></remarks>
Public Class Indicator
    ''' <summary>
    ''' Specifies the type of indicator that will be displayed on scatter plots or at the junction of line charts.
    ''' </summary>
    ''' <remarks></remarks>
    Public Enum Type As Integer
        None = 0
        Box = 1
        Circle = 2
        Cross = 3
        LeftArrow = 4
        RightArrow = 5
        UpArrow = 6
        DownArrow = 7
        Rectangle = 8
    End Enum

    Private moColor As Color
    Private msnOpacity As Single = 1
    Private miAlpha As Integer = 255

    Private miIndicatorWidth As Integer = 10
    Private miIndicatorHeight As Integer = 10

    Private miIndicatorType As Type

    ''' <summary>
    ''' Creates a new indicator with the specified type and color
    ''' </summary>
    ''' <param name="iType"></param>
    ''' <param name="oColor"></param>
    ''' <remarks></remarks>
    Public Sub New( _
        ByVal iType As Indicator.Type, _
        ByVal oColor As Color)

        miIndicatorType = iType
        moColor = oColor
    End Sub

    ''' <summary>
    ''' Creates a new indicator with the specified type, color and size
    ''' </summary>
    ''' <param name="iType"></param>
    ''' <param name="oColor"></param>
    ''' <param name="iIndicatorSize"></param>
    ''' <remarks></remarks>
    Public Sub New( _
        ByVal iType As Indicator.Type, _
        ByVal oColor As Color, _
        ByVal iIndicatorSize As Integer)

        miIndicatorType = iType
        moColor = oColor

        miIndicatorWidth = iIndicatorSize
        miIndicatorHeight = iIndicatorSize
    End Sub

    ''' <summary>
    ''' Creates a new indicator with the specified type, color, size and opacity.
    ''' </summary>
    ''' <param name="iType"></param>
    ''' <param name="oColor"></param>
    ''' <param name="iIndicatorSize"></param>
    ''' <param name="snOpacity"></param>
    ''' <remarks></remarks>
    Public Sub New( _
        ByVal iType As Indicator.Type, _
        ByVal oColor As Color, _
        ByVal iIndicatorSize As Integer, _
        ByVal snOpacity As Single)

        miIndicatorType = iType
        moColor = oColor
        msnOpacity = snOpacity

        miIndicatorWidth = iIndicatorSize
        miIndicatorHeight = iIndicatorSize
    End Sub

    ''' <summary>
    ''' This is the color to use for the indicator.
    ''' </summary>
    ''' <value></value>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Public Property Color() As Color
        Get
            Return moColor
        End Get
        Set(ByVal value As Color)
            moColor = value
        End Set
    End Property

    ''' <summary>
    ''' This is the relative opacity of the indicator. A value of 1 is completely opaque. A value of 0 is transparent.
    ''' </summary>
    ''' <value></value>
    ''' <returns></returns>
    ''' <remarks>Defaults to 1.0</remarks>
    Public Property Opacity() As Single
        Get
            Return msnOpacity
        End Get
        Set(ByVal value As Single)
            msnOpacity = value
            miAlpha = value * 255
        End Set
    End Property

    ''' <summary>
    ''' The width of the indicator. This property can be used in conjunction with IndicatorHeight
    ''' to create bubble charts using the ScatterOverlay overlay type.
    ''' </summary>
    ''' <value></value>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Public Property IndicatorWidth() As Integer
        Get
            Return miIndicatorWidth
        End Get
        Set(ByVal value As Integer)
            miIndicatorWidth = value
        End Set
    End Property

    ''' <summary>
    ''' The width of the indicator. This property can be used in conjunction with IndicatorWidth
    ''' to create bubble charts using the ScatterOverlay overlay type.
    ''' </summary>
    ''' <value></value>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Public Property IndicatorHeight() As Integer
        Get
            Return miIndicatorHeight
        End Get
        Set(ByVal value As Integer)
            miIndicatorHeight = value
        End Set
    End Property

    Friend ReadOnly Property Alpha() As Integer
        Get
            Return miAlpha
        End Get
    End Property

    ''' <summary>
    ''' This is the dimension, in pixels, of the indicator. Write-only.
    ''' </summary>
    ''' <value></value>
    ''' <remarks>Default is 10. To retrieve the current indicator size use the IndicatorWidth and IndicatorHeight properties</remarks>
    Public WriteOnly Property IndicatorSize() As Integer
        Set(ByVal value As Integer)
            miIndicatorWidth = value
            miIndicatorHeight = value
        End Set
    End Property

    ''' <summary>
    ''' This is the type of the indicator
    ''' </summary>
    ''' <value></value>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Public Property IndicatorType() As Type
        Get
            Return miIndicatorType
        End Get
        Set(ByVal value As Type)
            miIndicatorType = value
        End Set
    End Property
End Class
